IndexError fixed