fix deletion during writing