added check for input