fix reference stuff