Fix wrong key inference on matching.