Fixed set method to properly update $root and $path vars