Fix counting problem in debugger