use flag to keep cleanup from running twice