Fixed console I/O bug