Updated category gathering logic (NULL category name occured in db.)