Fixed issues do to changes in Django 1.6.