fix for reference before assignment