fix array out of range bug for del and update