Write base64 properly