fixed query handler