add a timeout for select