fixed up input checking