Fixed error if categories is null