Fix PEM certificate loading that sometimes fails