corrected index handler