improce b64 implementation