added end of file delete handling