Fix Theme.php to work properly in HTTPS or with a port different from de...

...fault