More tests and fix the deadline overflow check.