Fixed bug with broken refs