A couple fixes to the way links are created