Fix bug in abort logic