add some lifecycle hooks