Fix log reffarence bugs