CMD key disables pressed keys

I wrote a very simple standalone program that captures and displays the pressed keys on screen, so I can implement my own long presses, etc.

I’ve done it using a timer that checks the relevant keys using KeyPress::isKeyCurrentlyDown().
To check the modifiers, I used “modifierKeysChanged”.

That seems to work perfectly well with all keys and modifiers, except one: the command key.
Seems like if I have, say, the 'a" button held, pressing the command key will cause ‘a’ to always return false on a KeyPress::isKeyCurrentlyDown().

Tested on Mac OS High Sierra.

What’s the right way to go about it and know the exact state changes of keys?

Any ideas on what’s the best way to get accurate key up/down state for all keys?