root end detection slightly corrected