Fix errors on Django 1.3