Fix key modifiers

I end up receiving the event modifier events starting from 1024. Masking fixes this. Is there a nicer way of doing this?