Fix monitor inp/out code