Fix debug code checking wrong address (relied on side effect of sub function)