Actually fix failing tests.

Functions defined inside of functions cause everything to fatal when the parent function is called twice.