Changes to handle machine off