fix issue #15 - function declarations only at top level scope