Simplify top-path detection

Change-Id: I72f61b57b429db5e75f2dc8a880cf6963026c821