various patches and adjustments for idempotency and more effective
conditions