Switched order of arguments in write_file