improved finalization