added flag write_data