Correction to initial implementation of #696 to ensure deactivation only affects the given window.