Fix NPE when doing wildcard matching