Fix up some key handling