fixed char checking bug