Fix offset with last.

Updated version for #9606
Closes #7441

\cc @senny