fixes for states & daemonize fixes etc