actually fixing the wildcard bug

The previous commit was supposed to fix it, but actually produced a
more problematic bug. This fixes both issues.