Fix class field references properly