Treeset and treemap improvements

(this PR replaces the previous #231, broken one)

Fixed TreeSet bug #224.
Notice that this involved actually fixing TreeMap, used internally by TreeSet.
Found that the problem was in re-balancing of the tree after removal of an element.