fix bugs in views.py