fix bug in auto_root()