Ported fix for reordering tear down