fix range calcuration bug