fix shared array index error