Fixed bug in r-tree