client: flow and sensor cleanup; server: key_event handling improvments