Fix out of bound array addressing