change TABs to spaces, and refine libdaemon