return nil when no categories defined instead of throwing exception