use select instead of poll