stop wasting cpu cycles with gevent.sleep(), other fixes