improve page lifecycle events