Improved OSX key handling.