Fixed problem relating to issue #1 where closing an image resulted in "Uncaught RangeError: Maximum call stack size exceeded".
Merge branch 'hotfix/#1' into develop