Fix key detection