flask should be threaded otherwise it get stuck