may be we could suspect the debounce time for your switches ... 50 µs is rather a short time !

did you try to use a little pause for settling ???

Alain