Hi. the best way you can avoid it, is using some of the previous methods.
The reason is, when you hold a key, windows reacts as if the key is being pressed quickly.
There is no way to know if you hit very quickly some key, or you just hold it.