add error handling support