Have you included the UDF in your script?