Fixed logic bug in measuring lifetime