splay tree and bug fixes