Fix getrootdir bug when all paths at top-level.
Closes #537