Fix bugs found from marvin test.
First time test_vm_iam.py is completely passed.