use function declaration according to the context

```bar``` is undefined in current code (it uses function expression)