Fixed errors upgrading to Django 1.5