Fix recursive toJSON with missing relations