protected function resolveMachineReference(string $reference_name, array $properties_cache): Reference
	{
		if (!isset($this->references[$reference_name])) {
			throw new \InvalidArgumentException('Unknown reference: '.$reference_name);
		}

		// Get reference configuration
		$r = $this->references[$reference_name];

		// Get referenced machine id
		$ref_machine_id = array();
		foreach ($r['machine_id'] as $mid_prop) {
			$ref_machine_id[] = $properties_cache[$mid_prop];
		}

		// Get referenced machine type
		$ref_machine_type = $r['machine_type'];

		return $this->smalldb->getMachine($ref_machine_type)->ref($ref_machine_id);
	}