Create CloneHeap function, fix script version checking behavior