added certificate validation