bug fix on array insert