Test and fix some sql ufuncs