handle errors a bit better (#1)