Fixed compatibility with django 1.8