fixed array out-of-bounds exception