Bugfix in setting of reference