fixed the capture sql statement