Fixed d() function.