Improve SQL handling.