Fixed key detection bug.