Fix several Virtual Machine bug