changes to prevent invalid input