add error handler and fix_select_bad_fd_sets