Improved baseurl handling