Fixed http/https switch problem