Fixed bug where setting -1 timeout would result in a default timeout