fix queries for ctegories from user.
map changed to distinct