fix index for wrong array