fix bug 2776: ensure a non-negative domain for checking