fixed some bugs that error user input will crash the program