Fixed insert and update statements