Fixed bug in power switch