fixing loop threads