Fixing bad refs