Fixing getting out of bounds.