Fixed the nullPointer error in Tree, Was Tested