Fix image insertion code.