add logs when daemonizing
fix pep8 warnings