Fixes to-image bug found by Loïc Faure-Lacroix