modified some stuff, now seems to work fine on django-1.6