fix array undefined issue