Bug fix in views.py