Added support for custom port

Fixed bug affecting ROOT_URL when not set in configuration