Fix for restarts/updates issues when running as a daemon.