Django 1.4 fixes

Addresses #532 and #533.