fixing bugs in life cycle handling