Fixing bug in URL generation