fix bug in timeout approach