Fixed obscure encoding bug