Fixed bug where initial state was overridden