added certificate expiration check