bug fix in write paths