fix issue when unable to retrieve peer certificate