Fixed errors pertaining to global variables in Python