Fixed a bug in range