Fix incorrect range test