correct reference in castToJSON layer