Fix parsing error when waiting for input() and improve output pretty printing