improve failure case handling