Bug fixes and merge with saebyn commits

My version is reported to work with Django 1.4.

I have also fix some important bugs.