Fix terminal handling in monitor.c