try to fix array out of bound