Fix for a number of user function definitions.
These problems were picked up by the unit tests.
Authored by: bugman 2012-05-24
Parent: [r16431]
Child: [r16433]