Small loop bug in tb state machine fix