Bug fix in how we remove segments of paths

Was not a good to make paths beginning with root dir.