Adding join_root test and fixing bugs.