Fixed various referencing problems