Fix key handling.
Port another sample.