Fixes a crash when initialState is null