fix to code preventing bad ordering of valid letters