[RewriteRules] fix reduction rule with only one head

The subterms of the head were "removed" from matchable set instead of the head.
[RewriteRules] fix: scope of variable not closed
Merge pull request #1 from bobot/tiliang

[RewriteRules] 2 fixes