Revert "Simplification and improvement of "subst x"."

This reverts commit 9954c11bc1bbb44ad7328c8f2c249656e5cc8d17. While fixing a bug,
this patch introduced incompatibility with the previous releases.