Fix a bug in double tap detection