fixed a bug with range selection