use shutdown function to improve select