changes for more python and django compatibility