Fixed select() code for Linux