fixed bug in length attribute of collection