fixing bugs and making tests for LeafSet
debugged and tested LeafSet