fixed 'referenced before assignment'