modified base.py