updated api doc, fixed error reporting