Fix QUIT detection