fixed global variable rferenceing in views.py