fixed: 're' referenced before assignment