fix select timeout, add some macro