Make invalid paths return undefined

Rather than returning the leaf node above its possible place.