Fix for sql statement