Fixed bounds check failure in Categorical