smartButton problem

Hello,
I am tring to figure out why this doesnt work:

set smartButton to button returned of (display dialog ("Do you want to keep your Smart Playlists that are currently on your iPod?") buttons {"No", "Yes"} default button {"Yes"} with icon 1)
		tell application "iTunes"
			repeat with i from 1 to the count of sources
				if the kind of source i is iPod then
					set thePod to the name of source i as text
				end if
			end repeat
			tell source thePod
					delete every track of playlist thePod
					if smartButton is "Yes" then
						repeat with thePL from 1 to the count of device playlists in thePod
							if playlist thePL is smart then
								-- do nothing
							else
								delete playlist thePL
							end if
						end repeat
					else
						delete every track of playlist thePod
						delete every user playlist
					end if
			end tell
		end tell

The problem i think lies in the fact that the number of device playlsits returned is 0 and it should be 2. I have tried to change it from device playlist to user playlist and even just playlist, but it always returns 0.
Any ideas why this isnt working properly?
Thanks,
JO

Nevermind…
here is the functional code if anyone wants it:

set smartButton to button returned of (display dialog ("Do you want to keep your Smart Playlists that are currently on your iPod?") buttons {"No", "Yes"} default button {"Yes"} with icon 1)
tell application "iTunes"
	repeat with i from 1 to the count of sources
		if the kind of source i is iPod then
			set thePod to the name of source i as text
		end if
	end repeat
	tell source thePod
		delete every track of playlist thePod
	end tell
	if smartButton is "Yes" then
		repeat with thePL from 1 to the count of user playlists in source thePod
			set theName to the name of user playlist thePL in source thePod
			if the smart of user playlist theName in source thePod is true then
				-- do nothing 
			else
				delete user playlist theName in source thePod
			end if
		end repeat
	else
tell source thePod
		delete every track of playlist thePod
		delete every user playlist
end tell
	end if
end tell

thanks,
JO