fixing up error handling for api methods