fix timeout check, see #18
Merge origin/master