Fix index when accessing pipe thread