Fixed issues with django 1.6.