Updates to support running under gunicorn (fixed).