Fix small bug with timedelta function