fix compatibility issues with django 1.7