Fixes for state management.