fix

fixed the part where `receiver` was referenced before assignment, and some pycharm suggested refactoring