last round of fixes for py3.3, but compatibility with django 1.4 is broken