fix return type casting for script-based-UDFs