Fixed database updating issues