handle initial state correctly