do not throw exception when execution reaches the end in the debugger
minor refactoring