Better handle error conditions