code changes to support deployment to django 1.6