Fix root dir detection.