fix bug when the view is restored(opened)