avoid race condition for deploy/undeploy events