fixing worker loop