Repair interactive mode

Too hard to test with stdout and stdin. I tried :(