Fix var type inference2

Giving it another try.
can you add a comment here explaining why you believe cloning is necessary here?