fixed dodgy check for active_count(). Attempt old setDaemon() api first to support older Python versions