tree search bug fix and ccall type cleanup