Fixes $root and adds a test to validate.