Fixed some incorrect array indexes.