fixed some invalid input issues