changed write to puts