trying to fix encoding bugs