Fixed I/O redirect bug