Make VM inference more reliable.

Resolves #1072.  Resolves #925.