Fixed a bug in the computation of the safe minutes and in the counter