fix timeout test
die if timeout
fix timeout logic
add timeout tests