added middleware for user locals