Wrap foreach in check for .