fix display hang when restoring the app window