a few minor fixes with var instantiation and nullifying