fixed bugs in daemon