fix reference before assignment