Fix bug in printing imagedef stages (APPENG-2783)