adding code to accomodate certs with no intermediate