fix tie-breaking in prefix/wildcard matches
resolves #2