fix array overflow