fix array out of bound