add some logic to the hack to prevent shutdown while running