Fixed bug with delete on termination flag