bug fix for range