Made sampler2D check more robust.