fixed a problem where class variables would be updated erroneously