own flatten without underscore
fix old root detection