Problem returning a System Events reference from a stay-open applet

Hi,

I am working on a GUI-scripting handler whose task is to perform a search and then return a reference to a System Events user-interface element meeting the search criteria (the underlying purpose of which is not especially relevant to the more general question of this posting.) When the code for the handler is incorporated into the calling script, the handler’s return value is a reference to a System Events user-interface element as one would expect. For example:

on get_ui_element_reference()
	tell application "System Events" to tell process "Finder" to return scroll area 1
end get_ui_element_reference

set uie to get_ui_element_reference()

-- The handler's return value is a fully formed System Events reference:

return uie --> scroll area " " of application process "Finder" of application "System Events"

-- Getting some of the return value's property values further confirms that it is a fully formed reference:

using terms from application "System Events"
	return {uie's position, uie's size} --> {{0, 0}, {1280, 854}}
end using terms from

And now the problem…

When I place this handler in a stay-open applet, then target the stay-open applet and call its handler, the return value is no longer a System Events reference but now a reference “belonging to” the stay-open applet:

For example, save the following script as a stay-open applet named “StayOpenApplet”:

on get_ui_element_reference()
	tell application "System Events" to tell process "Finder" to return scroll area 1
end get_ui_element_reference

Launch the applet, eg, by double clicking its icon. Application “StayOpenApplet” will now be running. Now try to get the System Events reference to the user-interface element by targeting the running application and calling its handler in the following calling script:

tell application "StayOpenApplet" to set uie to get_ui_element_reference()

-- The handler's return value is no longer a System Events reference but rather one "belonging to" the stay-open applet:

return uie --> scroll area " " of application process "Finder" of application "StayOpenApplet"

-- Trying to get some of the return value's property values further confirms that it is no longer a proper System Events reference:

using terms from application "System Events"
	return {uie's position, uie's size} --> StayOpenApplet got an error...
end using terms from

So the question is, is there a way to get the stay-open applet to return the original System Events reference rather than one now belonging to the stay-open applet?

Thank you very much in advance for any suggestions.