Fixed failed test of wrapper api class

I cherry picked your branch "wrapper_api_class" to current HEAD of master,
and fixed failed tests.