fixed invalid input related crashes