fixes and improvements in vm