Fixed errors in UDFs