toJSONByPrototype function added