added check on input