Compatability with express 4.0

As of express 4, res.locals is no longer a function, so we need to treat it as a plain JS object.