added defaults for d func