Better illegal char check