modefied orm.py