fixed a bug that did not always check user input correctly