added support if intermediate certificates