fix bug for state