query fixing