Fixed bug in tree insert and adjust