avoid redundant calculation of the value of category_p