Variable scope was incorrect
Fix root detection