Fix bug in instantiation of 'with' variables