fixed long-running debug bug. Fixes #2