tested writing to file