fixed a bug with range.