Fix for range bug