Fixed potencial bug in update_max_time function