Changes to make life-cycle work correctly