Fix multi-vm

Includes @tmatilai's changes from #12 and makes it compatible with master