Path resolution cleanup

Backport of #3085 to 3.0