fixed a bug in calculation root and added save posiction