Fix for daily counters bug ...

... I made several tests on my DB and fixed some small problems. It
seems quite reliable now :-)