Fixing encoded byte issues