change to gevent loop