Fix barely-working timeout code (callbacks are hard)