fixed: script looping on reboot, plus minor bugs