Fix sometimes-ambiguous query