(1) Fixing size using cast. (2) Fixed name of context state.