power on/off bugfixes and cleanup