Fix base64 encoding when creating files