Fix 'factory already defined' error