fixing self-ref error