Added compatibility with django versions 1.6. Fixed some minor bugs