Fix a crash when changing the movement of the hero. Fix #392.