basetransform: don't unref trans until the function is done using it