Restoring after memory leak in backup function