Django 1.6 compatbility and some other small changes