fixed bugs for user input validation