Bug fix: toJSON method now works also if join is field (returning rec), not just index (returning recs).