Fixed compatibility issues with Django 1.4.5