fix bugs in abort funciton