Fixed various reference errors.