Index out of bounds fixed