Handle some errors more cleanly