Further fixes and refinements to state maintenance