solved array out of bound bug