improve python 3 input handling