Fixed authentication on state changes