I solved this problem by myself. In the onPause and onResume events, I performed a state change that caused the object to be rewritten on the top stack page. This caused all the stacked pages to disappear. I have changed the onPause and onResume events to exclude the case of scan startup and shutdown, and now they work fine.