Fix reference generation