fixed bug counting the attributes