[BUGFIX] Function buildUrl does not handle port setting