fix distinct bug