fixed UDF generation