state changed is called on update