Fix app use order of middleware to allow locals variable object to be set.