Switched from insert-and-never-update to upsert, fixes #47