Fix reference errors