fix bug with null initial state