Fixes referenced before assignment bug.