Fixes issue #805

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