Minor improvement for gplot.  Also minor fix for sql_cmd_query.