Fixed a couple of bugs in path resolution routine

Change-Id: I2e7754ec8aec3f882c9e624f65842cd55acc9049