fix timeout problem

Timeout was not properly calculated after the commit
bea18e2771455ec164f8d951dc2fc48987db073c.