Fixed the while loop when the category does not exist.