Update server.py

flush before detection