fix exception when the fragment is not attached anymore