Fix issue #805

Fixes JavaScript error, undefined variable $grid, when using strict mode.