fix previous function for category