nit: properly handle error