Fix a loading bug if changing state halfway through changing state