Fixed more bugs and loops with a time threshold.

However, I'm not satisfied.