Fix memory leak, fix use of cespdin