Fixed HTTPS redirect bug