Corrected index setting and removed unnecessary log