fixed bug in time keeping