fix bad array subscript err