Fixed bug where structural variables would keep using logprob values that had been invalidated by calls to grad()