Fix error accessing class variable