Fix for issue where 'function' would not define a function if the
arguments came before its name. Fixes #1240