Fix update function
Add database script