fixed bug in SQL::insertOrUpdate