fix previous function for category

fix query for category