Inconsistent Modal Dialog Error on IE7 and IE8

has anyone seen this error before?

I get the error below when trying to open a modal dialog in IE7 and IE8
with Watir.Now the Bizarre thing about this error is that the code works
fine on the machines where the code was written and we are unable to
replicate this error on those machines. We have tested this item
successfuly in IE7 and IE8 and we have been running it for 2 months
until we hit this snafu.

This error only happens on 2 new machines with IE7 and IE8

Code:
$ie.modal_dialog.frame(:index,1).span(:text,‘Button’).click_no_wait

waits=1
30.times do
begin
puts TimeStr() + "Waiting For " +
$ie.modal_dialog.frame(:index,1.span(:id,‘TestItem’).text
break
rescue
sleep(1)
waits = waits + 1
end # begin
end#

This bit of code runs fairly well and usually exits after 5 seconds,but
we get the error on our run machine.our loop exits after 30 secons
without the modal window and the script just dies.

Error:

C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/modal_dialog.rb:37:in
locate': Modal Dialog not found. Timeout = 2.0 (Watir::Exception::NoMatchingWindowFoundException) from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/modal_dialog.rb:86:ininitialize’
from
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/container.rb:186:in
new' from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/container.rb:186:inmodal_dialog’