fix extra block on writefile