Properly implement check in method 'touch'

A previous commit introduced a check whether the element to-be-touched
is actually contained in the container.  That patch caused the test
to fail.  The new patch fixes this.