add better error reporting