Hotfixes rootpath

I think this commit fix the bug with RootPath computation. Explanation of bug and fixes is in the commit log.

I am not sure how to use github pull request with tags (I created one but was unable to use it in the pull request) so I create a branch with the commit and create this pull request.

Hope it is OK. If not  do not hesitate to show me the "good" way.