Fix bug in range logic