fixing bad references