fix allocateOnHeap switch
fix