This contains several fixes, including the FD_ISSET signature change that the previous patch in this PR needs.