Fix bug in state initialization