Fixed email on shutdown/reboot bug