fix gateway shutdown process for flips.