Upgrades to make it run on django 1.6