fix init state bugs