Fixed the repeated keys detection algorithm on Linux