Fixing Bugs related with Sql db