Fix regression that caused waitForXXX(-1) to fail.