diff --git a/zonedl.py b/zonedl.py
index 2e8d085d106f199129e3fe2644161b67c8ca633d..795e4cb24eda2a033da0df2f6337b326bda51fe0 100755
--- a/zonedl.py
+++ b/zonedl.py
@@ -10,7 +10,7 @@ import sys
 from pathlib import Path
 
 parser = argparse.ArgumentParser(description='Downloads a zone file from RWTH DNS-Admin-Portal.')
-group = parser.add_mutual_exclusive_group(required=True)
+group = parser.add_mutually_exclusive_group(required=True)
 group.add_argument('--list', action='store_true', default=False, help='list available zones')
 group.add_argument('--zone', type=int, nargs='+', help='download zone by id')
 group.add_argument('--domain', nargs='+', help='download zone by name')
@@ -26,8 +26,8 @@ SHIB_REDIRECT = 'https://noc-portal.rz.rwth-aachen.de/Shibboleth.sso/SAML2/POST'
 
 if args.passwordstore:
     prc = subprocess.run(['pass', 'show', args.passwordstore], stdout=subprocess.PIPE, check=True)
-    USERNAME = prc.splitlines()[1].strip()
-    PASSWORD = prc.splitlines()[0].strip()
+    USERNAME = prc.stdout.splitlines()[1].strip()
+    PASSWORD = prc.stdout.splitlines()[0].strip()
 else:
     USERNAME = input('Username: ')
     PASSWORD = getpass.getpass()
@@ -55,7 +55,7 @@ def get_zone_file(session, zone):
             return ''
     b = bs4.BeautifulSoup(r.text, 'lxml')
     t = b.find(id='extra-wrapper').find('span').text
-    return t.replace('<br>', '\n')
+    return t.replace('<br>', '').replace('\n\n', '\n') # \n
 
 def shib_auth(session, resp, iterations=0):
     b = bs4.BeautifulSoup(resp.text, 'lxml')
@@ -120,8 +120,11 @@ else:
         if a not in wanted:
             print('Zone {} is not available, skipping'.format(a), file=sys.stderr)
 
-for w in wanted:
-    if fp is None:
-        fp = open(str(Path(args.dest) / w), 'w')
-    print(get_zone_file(s, w), file=fp)
+if fp is None:
+    for w in wanted:
+        with open(str(Path(args.dest) / str(w)), 'w') as fp:
+            fp.write(get_zone_file(s, w))
+else:
+    for w in wanted:
+        fp.write(get_zone_file(s, w))