Fixed an array traversal issue