Fix query segment