fix the issue of 2d gate matching when y is NULL