Fix query segment builder.