proper toJSON, original object was altered