add fn assertion to app.use(). Closes #337