bug fix of range