Bug fix for build url function