Fix array subscript is above array bounds