I understood, i have to make a prior of a last pressed key and deactivate previous one.
Moreover, it does not work with combination of other keys, like control, shift etc.
Found one more bug. When I am pressing W and then Q, then releasing q, w has no effect. I understand why it happens (because when i release q it sets w to UP), but I dont know how to fix that, chech if initial w is pressed?