fixed bug in timeout calc