Fix deamon function,