Adding more error check in OARrestapi.