Repair the occurred heep-bug when ending process.