fix count function for parent category