fixed even more bugs in inRange().