Budspencer: fix bug in d function