bugfix: don't pop the next path unless we're done.