fixed ref error