Check for string position instead of string existence

otherwise /foo/bar would be detected as a subfolder of /bar

THX @icewind1991