Fixed checkBaseURL to properly generate URLs given a <base> tag