Fixed comparison of `Range` with non-range objects

Fixes ticket #164.

Patch from Chris Withers on master.