correct the daemon function and add the flag of status