fixed up the linked query problem