Fixes replacement of SVG images in IE7

Builds on #1579 and fixes #1576.