take null labels into account when testing substrings