fixed bug with attr length counting