possible bug with doLinks function