make sure an item has children before adding class