Added license and fixed appendNewPtree/reallocPtree using uninitialized values