Script behaving differently whe executed on run & on importaction

I want to convert CRW files to DNG files autmaically when I import them into Aperture. So I have written a script (called Convert) that is called when the ImportActionForVersion event (provided by Aperture) is triggered which is supposed. From what I can determine a list of image versions is supposed to be passed in when the event is triggered. I have a separate script which executes the exact same Convert code when I select the Files that exist in my Aperture library. When I run the code using selected files it works like a champ. When I use the ImportActionForVersion to run the script I get to a section of code that exports the current image version to a temporary folder. It is at this point that the wheels fall off and mysterioulsy the “on run” code starts executing.

I use Script Debugger but I am stuck writing out text to a log file when I run the ImportAction version of my script using Aperture so this is hunt and peck. Does anyone have any ideas? It seems like there must be something different about the image version being exported - but I am not sure how I can determine what it is writing out simple text.
OS X Server, Mountain Lion Server

Any thoughts???[center][/center]

Model: iMacm (happens with10.7 & 10.8)
AppleScript: Latest
Browser: Safari 7534.48.3
Operating System: Mac OS X (10.7)