Improve range_hash. Fix tests failing.