fixes search query through join table