fix this logic to actually be correct... the fd can't be *both* -1 and an array index...