fixed negative timeout bug