Bug fix in categorical to index fix