Fixed timeout bug

Fix timed out bug to return correct value (the one that windows returns).