Fix image element generation so it works in Chrome.