fix complex_analysis_worker function
it seems that commit: f4b7951f
removed important part of at least that complex_analysis_worker
function for some reasons ...
this MR fixes that function reverting to what it was before the big cleanup but @gstark is there a way to check that commit did not remove some other important part of the code?
(cherry picked from commit 13e09848)