Fix reference before assignment