fixed print and write