error check based on comment
added test for input error