Fixed incorrect treatment of 'last'

The $grid is a number, and it's list length is always 1.
We want the number itself, not the 1.