added bad input handling