fix handling of key-down events