Fix reference resolving