fix shared array overwrite bug