Fix out of bounds issue.