Fix a bug: cow_domain.loc_upper was set improperly in C code