Fixed HTTPS function