Fixed issue with writing to temporary file
Finished hotfix wait_for_queue.