Incorrect array index fix