Fixed a few issues with the conversion to gevent.