It's just that the hysteresis calculation isn't good. Without R6 and R7, it would work as intended. But it won't have the hysteresis. If I'll put a buffer amplifier, it should also solve the problem. However, isn't there a simpler solution? Can I latch the LM393 to make it stay "0"?