Added cleanup_failed() func