Fix out of bound exception.