Added middleware to correctly load account data