Fixed bug in lifespan code