index range fixes