Fix array out of bounds crash.