fixed a bug on the timeout