status tree algo, fix bug.