fix related queries