Clean up ref resolution