Another attempt to fix dialog display logic.
Another attempt...