Barry is right. Any sort of schematic, even hand drawn and scanned to make .png or jpg would help lots.
The logic part, which pair signals first, counted while both are signalled together, is easy enough.
Your difficulty is getting reliable signal conditioning from the LED/photodiode pairs to deliver the change as a logic signal.
Without knowing the circuit, I can only suggest ..
1. Exclude unwanted IR from the photodetector. So shroud both the LED and the photodetector using some kind of tube/hood.
2. There is some distance across the path. Be sure of the range. The LED needs to be narrow beam
3. The photodiode might need some very simple optics to get the LED beam to focus on the photodiode.
4. Check the specification of the photodiode detector.
.. If just the diode, the circuit is different as for the more usual NPN or PNP transistor switch type output.
.. It needs to be biased via a resistor to extract the voltage change as the beam is cut.
5. Amplifying. Do you need to? If you do, you might need some simple RC filtering to exclude high frequency noise.
.. This is easy to add to an op-amp, often just by putting the right capacitor across the op-amp feedback resistor.
.. You only want to sense people passing. This happens at Hz - not kHz. So take the opportunity to clean up the signal.
6. Thresholding. Whatever is fed to the comparator, it must transit the voltage at the other comparator input.
Continuous blinking sounds like random noise triggering a transition - or maybe the micro-controller program is repeatedly looping some code. Try temporarily disconnecting the signal to the microcontroller, to check the blinking stops.