fix to be able to be run as a deamon