Debug Scripts and breakpoints


I have a modified version of IDEEditor to save project units to DB, I'm not storing the project, just the units. When I open a "DB project" I create a new project and add the units to the new project.

1. When debugging when I set a breakpoint on a secondary unit(not the main) the debbuging doesnt stop at the breakpoint.
2. When debugging at set a breakpoint at the main unit and step into a function located on a secondary unit, it works ok, but the activetab doesnt change automatic, I have to manually click on the secondary unit tab, when the execution of the function on the secondary tab end, the execution goes back to the main and also becomes the active tab.
3. I use the following code to start a transtion and end a transaction when debugging a DB script.
       IDEForm.FinalizaDebugSession; -> Here I Show a messagebox that the script has finished the                                                          execution.
3.1 When I Run the project without setting a breakpoint it works ok and one messagebox is shown.
3.2 When I set a breakpoint on the script  , and debug the script with F8 and then click the run button again, the messagebox is showed 2 times and sometimes 3 times.

Any hints how to fix the above issues.

Thanks in advance,

Omar Zelaya