Make check for `document` more consistent