fix input, ouput, read and write