Fixed assertion to enfornce idempotency of substitutions