Fix for base64 encoded zip file

plus a couple miscellaneous fixes