Fixed some bugs encountered in testing iam-plugin apis.