Correct dictionary encoding