fix encoding bugs
unneeded check