Changes to keyboard driver to prevent possible race conditions.