Make record.toJSON() work