Mutiple Modal Dialog close problem

Mutiple Modal Dialog close problem

I have two modal dialogs displayed on a page closing the topmost dialog closes the dialog but it removes the modal background for the remaining dialog box allowing the user to gain access to menus etc, that should remain disabled.
 
I'm using the following libs:
jquery-1.4.2
jquery-ui-1.8rc3
 
 
Any help would be appreciated