Simplify code at a few places

Remove some duplicate checks,
and unnecessary errors.