Fixed logic error that was causing runLoop() to use an invalid file descriptor