bugfix

i have corrected some bugfix of bad typed variabile or not used config var.
also i have inserted a code that count the number of field for the list.
:-)