fixing undefined class var error