Fixed an issue with daemonization code