Add if (evt.detail.startPowerOff) for better protection.