Fixed check for SQL command successs.