fix reference problems