Improve failure handling