Fixed sql statements.