updated b64 stuff for error handling