Ufuncify argument order

This is my attempt at fixing the issue I reported last week, #2971.

I am not 100% sure about the solution, but it passes the test, and also works with my own program. Please have a look.