Making INSERT and UPDATE queries more robust.