Fixed bug in the SQL builder