Fixes JSON distinct bug