fix out of range position bug
some comments
correct rounding