port module to lastest ms2 api
fix bug in last commit
Fix error being printed when there is no error.