encoding bug fixes

but there are still more bugs with base64, looking for the cause...