VPN Automation Setup script error

So I used to use the following and it worked in 10.8 and below.

set vpnname to "TEST"
set vpnserver to "vpn-test.com"
set vpnsecret to "123456"

display alert "Please note that you are about to configure a VPN connection." & return & return & "Please read and follow the on screen instructions carefully." as informational

tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.security" --get the name of every anchor of pane id "com.apple.preference.security"
reveal anchor "Privacy_Accessibility" of pane id "com.apple.preference.security"
set adminusername to display dialog "Please enter your Administrative username:" default answer "" with icon note
set adminpassword to display dialog "Please enter your Administrative password:" default answer "" with icon note with hidden answer
tell application "System Events"
tell process "System Preferences"
tell window 1
click button 1
end tell
end tell
end tell
--tell process system preferences
--if title of button 4 of window 1 is "Click the lock to make changes." 
--then set preferencesLocked to true
--click button "Click the lock to make changes."
--end if
end tell
display dialog "The process requires you to complete the following steps:" & return & "______________________________________________" & return & return & "1 - Unlock the padlock in the bottom left of the 'Security and Privacy' pane by clicking on it." & return & return & "2 - Provide your administrator username and password when requested and click 'Unlock'." & return & return & "3 - Now, place a check in the box next to AppleScript Editor." & return & return & "4 - When you have completed the above, click 'OK' on this box to complete the VPN setup." & return & "______________________________________________" & return & return & "(Please note that your Macs security will not be compromised as this change will be undone once the VPN is successfully configured)" & return & "______________________________________________" with icon note
if button returned of result = "OK" then
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.network"
set vpnusername to display dialog "Please enter your University username:" default answer "" with icon note
set vpnpassword to display dialog "Please enter your University password:" default answer "" with icon note with hidden answer
display dialog "Please wait while the operation is in progress, and do not click anything after you have clicked 'OK' below." & return & return & "This should no take longer than 1 minute. You will be notified when the process is complete." with icon caution
end tell
tell application "System Events"
tell process "System Preferences"
tell window 1
click button 9
--delay 1
end tell
tell sheet 1 of window 1
click pop up button 1
click menu item "VPN" of menu 1 of pop up button 1
click pop up button 2
--click menu item "L2TP over IPSEC" of menu 1 of pop up button 2
--click menu item "PPTP" of menu 1 of pop up button 2
click menu item "Cisco IPSec" of menu 1 of pop up button 2
set focused of text field 1 to true
keystroke "a" using command down
delay 1
keystroke vpnname
click button 1
--delay 1
end tell
tell group 1 of window 1
click checkbox 1
set focused of text field 1 to true
keystroke vpnserver
keystroke tab
keystroke text returned of vpnusername
click button 2
--delay 1
end tell
tell sheet 1 of window 1
set focused of text field 3 to true
keystroke text returned of vpnpassword
keystroke tab
keystroke vpnsecret
click button 2
--delay 1
end tell
tell window 1
click button 1
--delay 1
end tell
tell sheet 1 of window 1
click button 1
end tell
end tell
end tell
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.security"
--get the name of every anchor of pane id "com.apple.preference.security"
reveal anchor "Privacy_Accessibility" of pane id "com.apple.preference.security"
end tell
tell application "System Preferences"
quit saving yes
end tell
display alert "The configuration of your VPN connection has now been completed." & return & return & "Click on the \"Connect\" button to access the network." & return & return & "The connection status and various options are available through the menu bar at the top of the screen." as informational
else
tell application "System Preferences"
quit saving no
end tell
end if
--end tell

Since 10.9 came out the window has changed significantly and the following portion fails

tell application "System Events"
tell process "System Preferences"
tell window 1
click button 9
--delay 1
end tell
tell sheet 1 of window 1
click pop up button 1
click menu item "VPN" of menu 1 of pop up button 1
delay 2
click pop up button 2
--click menu item "L2TP over IPSEC" of menu 1 of pop up button 2
--click menu item "PPTP" of menu 1 of pop up button 2
click menu item "Cisco IPSec" of menu 1 of pop up button 2
set focused of text field 1 to true
keystroke "a" using command down
delay 1
keystroke vpnname
click button 1
--delay 1
end tell

and gives me an error:
error “System Events got an error: Can’t get pop up button 2 of sheet 1 of window 1 of process "System Preferences". Invalid index.” number -1719 from pop up button 2 of sheet 1 of window 1 of process “System Preferences”

I’ve googled and searched and found that this has broken for other people as well, but no one has a fix. So I’m reposting here since this seems to be the best forum applescript gurus

I posted in the following thread as well but the original issue is not related to mine
http://macscripter.net/viewtopic.php?id=42069

PLEASE HELP =)