modified b64 function