Fix for reboot bug, added locks on processes