Fix issues with URL generation