Fix write output