improved ref resolution