When I debug I usually do something along the lines of putting different beeps or print commands in the part of the code I think the problem is coming from. That usually gives me a better idea of exactly what the code is doing.