AppleScript to Unmount all drives

I often have many external volumes connected to my laptop at any given time (network drives, iPods, external HD, etc.). It can be annoying to manually disconnect each one of them before I unplug the USB hub. Instead I use a quick AppleScript to do the job of disconnecting all of my external volumes. I bind the script to a QuickSilver trigger and fire that up before I’m about to disconnect the hub. It saves me a bit of sanity.
Download unmount_all_drives.applescript
tell application "Finder"
set allVolumes to the name of every disk
repeat with i from 1 to the count of allVolumes
if item i of allVolumes is not the name of the startup disk then
-- Uncomment the 2 lines below if you don't want Network drives unmounted.
-- if item i of allVolumes is not "Network" then
eject (item i of allVolumes)
-- end if
end if
end repeat
end tell
This script gives an error if there’s only one mounted drive, because it will take the name of the drive to be the array to loop through. Not sure how to fix this, as I’m a newbie to AppleScript.