can deal with undefined lists foreach