Deal with errors more cleanly