undefined check for unobserve