debugging typically happens best by identifying known facts and working from there; the absolute most basic one is that you’re debugging the correct code, so if you have doubts there, it’s going to be hard to build any further investigation on such a shaky foundation