add nil protection on categories call