Fix out of bound access