used wrong array index