fix bug in delayed write