fix bug in dvapply (ifelse with function as output)