fixed onPause/onResume detach/attach listener