Bug fix - out of bounds index.