fixed losing states when configs change
added a sample for config changes
fixed losing state on a configuration change.