added power source sensing on startup