Dialog with img tag fails in IE 7

Dialog with img tag fails in IE 7


Using JQuery UI 1.6rc5:
The following click handler works perfectly in FF3
function test()
{
    popup = $('#testdiv');
    if (!popup[ 0 ].initialised) {
        popup[ 0 ].initialised = true;
        popup.dialog();
        popup.append( '<img src="/static/photos/2009/0119/3.zip/cache/
dsc_4668_popup.jpg" />' );
    };
    popup.dialog( 'open' );
}
In IE, the dialog opens once, and then after it's closed, never again
(and IE reports an undiagnosable error on subsequent clicks).
If you append div, anchors etc.. no problem, but if you append an img
tag, IE can't cope.
Anyone know what this problem is and how to work around it?