Correctly wait for user input