Fix bug in variable instantiations