fix array traversal failure bug