Fixes client side mem leak for dialogs and not correctly removing their scopes.