Fixed __len__ to return the right result