Fix offset with last.

Closes #7441
Merge pull request #13149 from laurocaetano/fix_offset_last

Fix offset with last.