fixed bugs in models.py