Fixed range check bug.