Fixed case-splitting

On case-splitting `x` in `test_x x = ...` or `test1x x = ...` it was replacing both occurences
of `x` (including that one in `test_x`, e.g. making it `test_Z` and `test_(S k)`).

Most likely this fix does not cover all the possible cases and it should be
fixed further.