fixed crash on dialog exit