checks for invalid chars