moved error messages for ref mismatch further up the call chain