Handle errors properly.