Fix #1730, also add a checkNull, which we were missing before.
Issue #1730: Revise test