fix race condition with notification