implemented onAddedToState