ensure encoding in the right place