Fix sync issues with database remove