Fix bugs in time logging