Fixed dialog losing scope after navigating away.