update writeback function