improved mistype logic