Fixes + add emitInitState + test case