update onExit to removeObserver