Prevent duplicate key events