Fixed bug when device restarts instead of shutdown when a charger is attached