fixed some timeout bugs