Fix "duplicates referenced before assignment" error