Fixed issue #166: Incorrect calculation of ending time strategy