updated script. it seems to work now.