Fix VM state returning to previous one due to a conflict with sync

Also fixes a couple of minor bugs