Bug fix for self-signed certificates