added try/except around insert/update statement - should do a beter upsert