Fix shutdown/reboot bug