Fix uc references with refcode. Add logging.