Fix bugs about std I/O