changes to handle invalid input