Fixing more problems with encoding and python types