fix clashing input and output streams