Script library loaded at different time when debugger is on

I have just stumbled across some annoying new behaviour in Notes 6.5.2 Designer (as compared with Notes 5).

On a form I have some hotspots which have a Use “xxx” statement in the (Options) part of the hotspot, where xxx is a script library. This means that the script library should only be loaded when the hotspot is pressed. I have verified that this is the case by inserting a Msgbox statement in the Initialise function.

However, when the debugger is active, this script library is loaded as soon as the document is opened, not when the hotspot is pressed. In my code, the Initialise event tries to fetch NotesUIWorkspace.CurrentDocument which returns Nothing. This then throws an error and prevents the hotspots from working when pressed subsequently (even though they do work when the debugger is not active).

This behaviour is new to Notes 6. It is very inconvenient, because the code behaves differently when debugging from when running normally. It might explain some other postings which are complaining about uiw.CurrentDocument not working properly.