Fix apiv3 wrapper
CRM-13016 api wrapper needs to deal with non-array results (getcount etc)
fix port of exception class