improve base64 encoding