(from patch) handles nested functions
Send errors to stderr