Fix UDF date formatting

Fixes #1046
Same here. If ``udf_def`` is nothing, throw some debug info.