fixed bugs for URL generation