fix some import bugs and add clear_queue