Fixed issue with hijacking user in middleware