lots of vm fixes