fixed heap corruption for link refs