Fix error "not an identifier" when getting number of parents

Hello,

When I run the script, the following errors appear :
_bd:local:2: not an identifier: 6
or
bd:local:7: not an identifier: 6

So I change the way to get the number of parents and the script works fine.