improve error handling to report particular errs