check added if test is in the correct state
If one clientid subscribes a lot of topics the old implementation struggles with the for loops