Fix a serious bug in deamon mode.