removed ' character from isIllegalChar function