Fixing some bugs in the code relating to times