Handle error condition better