Fix var type inference2

Giving it another try.
I think you need to check the kind here as well. What if the user puts K in a cell that contains a bag? What error will they get?