fix array subscript above array bounds