bug fix for sql query structure_text