Upgraded the update sql