removing spurious newlines from query