Fix https handling