re-added writing to file