fixes for range check