Fix issue where 'image' variable is not defined

Fixes issue 262
Merge pull request #263 from ameade/fix-image-variable-undefined

Fix issue where 'image' variable is not defined