fix base64 issue(using Leo's code)