fix two bugs concerning blocking fds