This if test sets all users active or not based on the status of only the first entry in the loop which is not what we want. This change fixes this bug.