Fix image expanding. Fixes #439