added more checks on bad user input