further improvement on mistype logic