Fixed database updating error