improved time handling